<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%String path=request.getContextPath();pageContext.setAttribute("path",path); %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.css" />
	<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
	<script src="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.js"></script>
</head>

<body>

	<div data-role="page" data-dialog="true">

		<div data-role="header" data-theme="b">
		<h1>我要评分</h1>
		</div>

		<div role="main" class="ui-content">
		<h1>请给专家的服务打分</h1>
		<div data-role="fieldcontain">
            <input id="slider_${answer.aid}"  type="range" name="slider" value="0" min="0" max="5"
            data-highlight="true">
        </div>
			<a href="${path}/question/details.do?id=${answer.question.qid}&_t=<%=System.currentTimeMillis()%>"  class="ui-btn ui-shadow ui-corner-all ui-btn-a"  id="setScore_${answer.aid}" >确定评分</a>
			<a href="#"  data-rel="back" class="ui-btn ui-shadow ui-corner-all ui-btn-a">取消</a>
		</div>
	<script type="text/javascript">
		$("#setScore_${answer.aid}").click(function(){
			var result=false;
			var data={ id:"${answer.aid}", score:$("#slider_${answer.aid}").val() };
			$.ajax({type:"POST",url:"${path}/answer/setScore.do",data:data,async:false,dataType:"json",success:function(r){
				result=r.success;
				if(result){
					alert("评分成功!");
				}else{
					alert("评分失败!评分人不匹配或已经评分");
				}
			}});
			return result;
		});
	</script>
	</div>

</body>
</html>
